package com.product.android.business.login;

import java.io.Serializable;

import com.product.android.business.bean.UserInfo;

/**
 * 工号登陆用户信息
 * 
 */
public class JobNumberUserInfo implements Serializable {

	private static final long serialVersionUID = -1285827226634284833L;

	// 用户ID
	private long mOap_uid;

	// 绑定的91账号UAP_ID
	private long mUap_uid;

	// 登录帐号
	private String mUser_name;

	// 昵称
	private String mUser_nick_name;

	// 密码(RSA加密的)
	private String mUser_pass;

	// 密码(MD5加密的)
	private String mUser_pass_md5;

	// 混淆后的MD5密码
	private String mUser_pass_mixed_md5;

	// 和票据一共使用的随机字符串（在获取票据时作为参数传入）
	private String mBlowfish;

	// 票据
	private String mTicket;

	// OAP单位ID
	private int mUnit_id;

	// 是否记住密码
	private boolean mIs_save_account;

	// 是否自动登陆
	private boolean mIs_auto_login;

	// 最后一次登陆日期
	private String mLast_login_dt;

	// 登录sid
	private String mSid;

	// 扩展字段
	private String mVar_ext;

	// 判断是否是手机登陆， 0 否， 1 是
	private int mIs_phone;

	// 单位代码
	private String mUnitcode;

	// 密码最后修改时间（NULL=没修改过）
	private String mPwdtime;

	// 91通行证帐号名（NULL=没有绑定）
	private String mBindUapAccount;

	// 身份信息，1：职员 2：学生 3：家长
	private int mIdentity;

	public JobNumberUserInfo() {
		init();
	}

	public void init() {
		mUser_name = "";
		mUser_pass = "";
		mUser_pass_md5 = "";
		mUser_pass_mixed_md5 = "";
		mTicket = "";
		mBlowfish = "";
		mSid = "";
		mUser_nick_name = "";
		mIs_save_account = true;
		mIs_auto_login = true;
		mIs_phone = 0;
		mUnitcode = "";
		mPwdtime = "";
		mUap_uid = 0;
		mBindUapAccount = "";
	}

	public long getOap_uid() {
		return mOap_uid;
	}

	public void setOap_uid(long mOap_uid) {
		this.mOap_uid = mOap_uid;
	}

	public long getUap_uid() {
		return mUap_uid;
	}

	public void setUap_uid(long mUapUid) {
		this.mUap_uid = mUapUid;
	}

	public String getUser_name() {
		return mUser_name;
	}

	public void setUser_name(String mUser_name) {
		this.mUser_name = mUser_name;
	}

	public String getUser_nick_name() {
		return mUser_nick_name;
	}

	public void setUser_nick_name(String mUser_nick_name) {
		this.mUser_nick_name = mUser_nick_name;
	}

	public String getUser_pass() {
		return mUser_pass;
	}

	public void setUser_pass(String mUser_pass) {
		this.mUser_pass = mUser_pass;
	}

	public String getUser_pass_md5() {
		return mUser_pass_md5;
	}

	public void setUser_pass_md5(String mUser_pass_md5) {
		this.mUser_pass_md5 = mUser_pass_md5;
	}

	public String getUser_pass_mixed_md5() {
		return mUser_pass_mixed_md5;
	}

	public void setUser_pass_mixed_md5(String mUser_pass_mixed_md5) {
		this.mUser_pass_mixed_md5 = mUser_pass_mixed_md5;
	}

	public String getBlowfish() {
		return mBlowfish;
	}

	public void setBlowfish(String mBlowfish) {
		this.mBlowfish = mBlowfish;
	}

	public String getTicket() {
		return mTicket;
	}

	public void setTicket(String mTicket) {
		this.mTicket = mTicket;
	}

	public int getUnit_id() {
		return mUnit_id;
	}

	public void setUnit_id(int mUnit_id) {
		this.mUnit_id = mUnit_id;
	}

	public boolean isIs_save_account() {
		return mIs_save_account;
	}

	public void setIs_save_account(boolean mIs_save_account) {
		this.mIs_save_account = mIs_save_account;
	}

	public boolean isIs_auto_login() {
		return mIs_auto_login;
	}

	public void setIs_auto_login(boolean mIs_auto_login) {
		this.mIs_auto_login = mIs_auto_login;
	}

	public String getLast_login_dt() {
		return mLast_login_dt;
	}

	public void setLast_login_dt(String mLast_login_dt) {
		this.mLast_login_dt = mLast_login_dt;
	}

	public String getSid() {
		return mSid;
	}

	public void setSid(String mSid) {
		this.mSid = mSid;
	}

	public String getVar_ext() {
		return mVar_ext;
	}

	public void setVar_ext(String mVar_ext) {
		this.mVar_ext = mVar_ext;
	}

	public int getIs_phone() {
		return mIs_phone;
	}

	public void setIs_phone(int mIs_phone) {
		this.mIs_phone = mIs_phone;
	}

	public String getUnitcode() {
		return mUnitcode;
	}

	public void setUnitcode(String mUnitcode) {
		this.mUnitcode = mUnitcode;
	}

	public String getPwdtime() {
		return mPwdtime;
	}

	public void setPwdtime(String mPwdtime) {
		this.mPwdtime = mPwdtime;
	}

	public String getBindUapAccount() {
		return mBindUapAccount;
	}

	public void setBindUapAccount(String mBindUapAccount) {
		this.mBindUapAccount = mBindUapAccount;
	}

	public int getIdentity() {
		return mIdentity;
	}

	public void setIdentity(int identity) {
		this.mIdentity = identity;
	}

	public UserInfo converToUserInfo() {
		UserInfo u = new UserInfo();
		u.setBlowfish(mBlowfish);
		u.setIs_phone(mIs_phone);
		u.setIsAutoLogin(mIs_auto_login);
		u.setIsSaveAccount(mIs_save_account);
		u.setLastLoginDt(mLast_login_dt);
		u.setmVar_ext(mVar_ext);
		u.setOapUid(mOap_uid);
		u.setUapUid(mUap_uid);
		u.setOapUnitId(mUnit_id);
		u.setSessionId(mSid);
		u.setTicket(mTicket);
		u.setUapUid(0);
		u.setUserName(mUser_name);
		u.setUserNickName(mUser_nick_name);
		u.setUserPass(mUser_pass);
		u.setUserPassMd5(mUser_pass_md5);
		u.setUserPassMixedMd5(mUser_pass_mixed_md5);
		u.setIdentity(mIdentity);

		return u;
	}

	public void converToWorkerUserInfo(UserInfo info) {
		this.mBlowfish = info.getBlowfish();
		this.mIs_phone = info.getIs_phone();
		this.mIs_auto_login = info.getIsAutoLogin();
		this.mIs_save_account = info.getIsSaveAccount();
		this.mLast_login_dt = info.getLastLoginDt();
		this.mVar_ext = info.getmVar_ext();
		this.mOap_uid = info.getOapUid();
		this.mUnit_id = info.getOapUnitId();
		this.mSid = info.getSessionId();
		this.mTicket = info.getTicket();
		this.mUser_name = info.getUserName();
		this.mUser_nick_name = info.getUserNickName();
		this.mUser_pass = info.getUserPass();
		this.mUser_pass_md5 = info.getUserPassMd5();
		this.mUser_pass_mixed_md5 = info.getUserPassMixedMd5();
		this.mIdentity = info.getIdentity();
	}

	public void clearPwdAndTicket() {
		mUser_pass = "";
		mUser_pass_md5 = "";
		mUser_pass_mixed_md5 = "";
		mTicket = "";
	}

}
